package com.editor.util;


import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.UUID;

public class PicUpload {


    public  static String savePic(MultipartFile pic){
        String picId= UUID.randomUUID().toString().replaceAll("-", "");

        String destUrl="/shuidian2/picture/MicroWebPic/p"+picId+".jpg";

        File destFile=new File(destUrl);

        try {
            pic.transferTo(destFile);
        } catch (IOException e) {
            e.printStackTrace();
        }

        return "http:www.wchenglearning.xyz/shuidian2/MicroWebPic/p"+picId+".jpg";



    }


}
